import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
// const {resolve} =require('path')
// import Icons from 'vite-plugin-svg-icons'
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons';
import path from 'path'
// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    Components({
      resolvers: [ElementPlusResolver()],
    }),
	createSvgIconsPlugin({
		// 指定需要缓存的图标文件夹
		iconDirs: [path.resolve(process.cwd(), 'public/img/svg')],
		// 指定symbolId格式
		symbolId: 'icon-[name]',
	}),
  ],
  css:{
    preprocessorOptions:{
      scss:{
        silenceDeprecations: ['legacy-js-api']
      }
    }
  },
	// alias:{
  //   '@':resolve(__dirname,'src')
  // },
  resolve:{
    alias:{'@':path.resolve(__dirname,'src')},
	// extensions:['.js','.ts','.vue']
  },
  define: {
    'process.env': {
      'BASE_API':"http://localhost:3000"
    }
  },

  server:{
    port:8081,
    open: true,
  }
})

